class Solution {
public:
    string makeSmallestPalindrome(string s) {
        int n = s.size();
        for (int i = 0; i < n / 2; i++) {
            char a = s[i];
            char b = s[n - i - 1];
            if (a == b)continue;
            if (a < b)s[n - i - 1] = a;
            else s[i] = b;
        }
        return s;
    }
};